#private
class train:
    def __init__(self,data):
        self=self.__change__(data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],data[8],data[9:])
    # ['Z36', 'GZQ', '广州', 'BXP', '北京西', '16:06', '13:44', '21:38', '--', '--', '--', '无', '有', '有', '无']
    def __change__(self,date,train_num,start_num,start_station,stop_num,stop_station,start_time,stop_time,time,seat):
        self.date=date                                  #日期
        self.start_station=start_station                #出发站名称
        self.stop_station=stop_station                  #到达站名称
        self.train_num=train_num                        #车次
        self.start_num=start_num                        #出发站代号
        self.stop_num=stop_num                          #到达站代号
        self.start_time=start_time                      #出发时间
        self.stop_time=stop_time                        #到达时间
        self.time=time                                  #历时
        self.special=seat[0]                            #特等座、商务
        self.first=seat[1]                              #一等座
        self.second=seat[2]                             #二等座
        self.sleep_soft=seat[3]                         #软卧
        self.sleep_hard=seat[4]                         #硬卧
        self.seat_hard=seat[5]                          #硬座
        self.stand=seat[6]                              #无座
        self.sleep=self.__getsleep__(self.sleep_soft, self.sleep_hard)
    def __getsleep__(self,soft,hard):
        ticket=0
        if (soft=='无' or soft=='--'):
            ticket+=0
        elif(soft=='有'):
            ticket+=20
        else:
            ticket+=int(soft)
        if (hard=='无' or hard=='--'):
            ticket+=0
        elif(hard=='有'):
            ticket+=20
        else:
            ticket+=int(hard)
        return ticket
#public
    def GetStartStation(self):          #出发站名称
        return self.start_station
    def GetStartNum(self):              #出发站代号
        return self.start_num
    def GetStopStation(self):           #到达站名称
        return self.stop_station
    def GetStopNum(self):               #到达站代号
        return self.stop_num
    def GetTrainNum(self):              #车次
        return self.train_num
    def GetDate(self):                  #出发日期
        return self.data
    def GetStartTime(self):             #出发时间
        return self.start_time
    def GetStopTime(self):              #到达时间
        return self.stop_time
    def GetTime(self):                  #历时
        return self.time
    def GetSpecial(self):
        return self.special
    def GetFirst(self):
        return self.first
    def GetSecond(self):
        return self.second
    def GetSleepSoft(self):
        return self.sleep_soft
    def GetSleepHard(self):
        return self.sleep_hard
    def GetSeatHard(self):
        return self.seat_hard
    def GetStand(self):
        return self.stand
    def GetTicket(self):                #车票情况
        ticket=0
        ticket=ticket+self.__getticketnum__(self.special)
        ticket=ticket+self.__getticketnum__(self.first)
        ticket=ticket+self.__getticketnum__(self.second)
        ticket=ticket+self.__getticketnum__(self.sleep_soft)
        ticket=ticket+self.__getticketnum__(self.sleep_hard)
        ticket=ticket+self.__getticketnum__(self.seat_hard)
        ticket=ticket+self.__getticketnum__(self.stand)
        return ticket
    def GetSleep(self):
        return self.sleep
    def Show(self):
        # print("车次\t出发站代号\t出发站名称\t到达站代号\t到达站名称\t",end="")
        # print("出发时间\t到达时间\t历时\t",end="")
        # print("商务/特等座\t一等座\t二等座\t软卧\t硬卧\t硬座\t无座")
        print("{:11s}".format(self.date), end="")
        print("{:5s}".format(self.train_num),end="")
        print("{:4s}".format(self.start_num),end="")
        print(self.start_station,end="  ")
        print("{:4s}".format(self.stop_num),end="")
        print(self.stop_station,end="  ")
        print("{:6s}".format(self.start_time),end="")
        print("{:6s}".format(self.stop_time),end="")
        print("{:6s}".format(self.time),end="")
        print(self.special,end=" ")
        print(self.first,end=" ")
        print(self.second,end=" ")
        print(self.sleep_soft,end=" ")
        print(self.sleep_hard,end=" ")
        print(self.seat_hard, end=" ")
        print(self.stand,end=" ")
        print(self.sleep)
















# ['G72', 'IZQ', '广州南', 'BXP', '北京西', '07:47', '18:22', '10:35', '无', '有', '有', '--', '--', '--', '--']
# ['Z202', 'GZQ', '广州', 'BXP', '北京西', '08:40', '06:49', '22:09', '--', '--', '--', '无', '有', '有', '无']
# ['G80', 'IZQ', '广州南', 'BXP', '北京西', '09:00', '17:01', '08:01', '无', '无', '无', '--', '--', '--', '--']
# ['G70', 'IZQ', '广州南', 'BXP', '北京西', '12:50', '22:27', '09:37', '1', '无', '有', '--', '--', '--', '--']
# ['Z36', 'GZQ', '广州', 'BXP', '北京西', '16:06', '13:44', '21:38', '--', '--', '--', '无', '有', '有', '无']
# data1=['G72','IZQ','广州南','BXP','北京西','07:47','18:22','10:35','无','有','有','--','--','--','--']
# data2=['G70','IZQ','广州南','BXP','北京西','12:50','22:27','09:37','1','无','有','--','--','--','--']
# data=[data1,data2]
# print("车次\t出发站代号\t出发站名称\t到达站代号\t到达站名称\t", end="")
# print("出发时间\t到达时间\t历时\t", end="")
# #print("商务/特等座\t一等座\t二等座\t软卧\t硬卧\t硬座\t无座")
# print("卧铺数")
# for i in data:
#     print(len(i))
#     t=train(i)
#     train.Getsleep(t)

# "周四 12月 2 2021"
# yyyy-mm-dd
# def change(str1):
#     out = str1.split(" ", -1)
#     if (int(out[2]) < 10):
#         out[2] = "0" + out[2]
#     out[1] = out[1][:len(out[1]) - 1]
#     if (int(out[1]) < 10):
#         out[1] = "0" + out[1]
#     str2 = out[3] + "-" + out[1] + "-" + out[2]
#     return str2